package chapter02;

import java.lang.reflect.Array;
import java.util.ArrayList;

/**
 * foreach循环和for循环
 * foreach循环是for循环的简写形式,它只能用遍历集合或数组,性能稍高于普通for循环
 * Created by a on 2017/6/9.
 */
public class Test038 {

    public static void main(String[] args) {
        int[] array = {2,2,3,4,5,6};
        for (int i : array){
            System.out.print(i+" ");
        }

        System.out.println();

        ArrayList<String> arrayList = new ArrayList();
        arrayList.add("wujie");
        arrayList.add("wujie1");
        arrayList.add("wujie2");
        arrayList.add("wujie3");
        for (String str : arrayList){
            System.out.print( str+" ");
        }

    }

}
